Skip to content

Conversation

@MarcGuiselin
Copy link
Collaborator

@MarcGuiselin MarcGuiselin commented Jan 10, 2026

If a mod spawns an entity on ModStartup and then gets reloaded there will be multiple duplicate entities in the world.

This pr adds tracking for entities spawned by a mod. If the mod is unloaded (despawned) or hot-reloaded the entities from the old version will be despawned. I think this is closer to what a user expects.

This behaviour is configurable and opt out via ModloaderPlugin::set_despawn_behaviour(ModDespawnBehaviour::None).

Depends on #31

@MarcGuiselin MarcGuiselin merged commit e0c41d8 into bevy-0.18 Jan 17, 2026
@MarcGuiselin
Copy link
Collaborator Author

MarcGuiselin commented Jan 17, 2026

Whoops, targeting the wrong branch. Cherry-picked and merged as 9470a68

MarcGuiselin added a commit that referenced this pull request Jan 17, 2026
@MarcGuiselin MarcGuiselin deleted the unload-behaviour branch January 17, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants